<!DOCTYPE html>
<html>
<head>
<meta charset="iso-8859-1">

<link rel="stylesheet" href="/brython.css">
<style>
#report {
    border-collapse: collapse;
}
td.report_cell {
    padding-left:1em;
}
td.number{
    text-align: right;
}
td.error_message{
    font-family: courier new;
    padding-left: 1em;
}
tr.method, tr.header{
    border-style: solid;
    border-color: #888;
    border-width: 1px;
}
tr.method:hover{
    background-color:#CCC;
}
</style>


<script type="text/python">
import sys

from browser import document, window

info = sys.implementation.version
document['version'].text = '%s.%s.%s' % (info.major,info.minor,info.micro)

_height = document.documentElement.clientHeight
_top = document['container'].offsetTop
document['container'].style.height = '%dpx' % (_height - _top - 10)
</script>

<script type="text/python">
import sys
import os
from test import support
import unittest
import HTMLTestRunner

from browser import timer
from browser import document, alert, bind, window, html

del document["msgbox"]

sys.path.append(os.path.join(os.environ['PYTHONPATH'], "Lib", "test"))

def flush(*args):
    from browser import console

# a submodule of unittest expects the output object to have a flush function
sys.stdout.flush = flush

@bind("#btn_test", "click")
def run_test(event):
    import time
    _start = time.time()
    document["container"].clear()
    sel = document['test']
    module = sel.options[sel.selectedIndex].value

    if module == '':
       return

    mod = __import__(module)
    _suite = unittest.TestLoader().loadTestsFromModule(mod)
    HTMLTestRunner.HTMLTestRunner(sys.stdout, verbosity=2).run(_suite)

    sys.stderr.write('completed in %s seconds' % (time.time() - _start))

@bind("#btn_show", "click")
def show_test(event):
    sel = document['test']
    module = sel.options[sel.selectedIndex].value

    if module == '':
       return

    mod = __import__(module)
    tab = window.open('show.html?file=%s' %mod.__file__)

</script>

</head>

<body onload="brython({debug:2,
                       static_stdlib_import: true
                       })">

<h1 style="padding-left:3%;">CPython tests</h1>

<div style="width:94%;padding: 0 3% 0 3%;">
<div style="float:left">
UnitTests:
<select id="test" autocomplete="off">
  <option value="">--choose test--</option>
  <!-- option value="buffer_tests">buffer_tests</option -->
  <!-- option value="relimport">Relative Imports</option -->
  <option value="test_abc">test_abc</option>
  <option value="test_base64">test_base64</option>
  <option value="test_binop">test_binop</option>
  <option value="test_cmath">test_cmath</option>
  <option value="test_collections">test_collections</option>
  <option value="test_compare">test_compare</option>
  <option value="test_complex">test_complex</option>
  <option value="test_contains">test_contains</option>
  <!-- option value="test_datetime">test_datetime</option -->
  <option value="test_decimal">test_decimal</option>
  <option value="test_decorators">test_decorators</option>
  <option value="test_defaultdict">test_defaultdict</option>
  <option value="test_deque">test_deque</option>
  <option value="test_dict">test_dict</option>
  <option value="test_errno">test_errno</option>
  <option value="test_exceptions">test_exceptions</option>
  <option value="test_float">test_float</option>
  <option value="test_format">test_format</option>
  <option value="test_fractions">test_fractions</option>
  <option value="test_funcattrs">test_funcattrs</option>
  <!-- option value="test_generators">test_generators</option -->
  <!-- option value="test_genericpath">test_genericpath</option -->
  <option value="test_global">test_global</option>
  <option value="test_grammar">test_grammar</option>
  <option value="test_hash">test_hash</option>
  <option value="test_hashlib">test_hashlib</option>
  <option value="test_heapq">test_heapq</option>
  <option value="test_html">test_html</option>
  <option value="test_imp">test_imp</option>
  <!-- option value="test_import">test_import</option -->
  <option value="test_index">test_index</option>
  <option value="test_int">test_int</option>
  <option value="test_int_literal">test_int_literal</option>
  <!-- option value="test_isinstance">test_isinstance</option -->
  <option value="test_json">test_json</option>
  <!-- option value="test_list">test_list</option -->
  <!-- option value="test_math">test_math</option -->
  <!-- option value="test_metaclass">test_metaclass</option-->
  <option value="test_module">test_module</option>
  <option value="test_operator">test_operator</option>
  <!-- option value="test_os">test_os</option -->
  <option value="test_random">test_random</option>
  <option value="test_re">test_re</option>
  <option value="test_set">test_set</option>
  <option value="test_string">test_string</option>
  <!-- option value="test_with">test_with</option -->
</select>
<button id="btn_test">Run test</button>
<button id="btn_show">Show test</button>

</div>

<div style="float:right">
Brython version: <span id="version"></span>
</div>
</div>

<div id="msgbox"
    style="position:absolute; left:100px; top:200px; width: 200px;
    height:auto; background-color:#9ed5d5; padding:40px; color:#000">
    Loading...</div>

<div id="container" style="clear:both; width:100%;height:50%;overflow:auto">
</div>

<script type="text/javascript" src="/src/brython_builtins.js"></script>
<script type="text/javascript" src="/src/version_info.js"></script>
<script type="text/javascript" src="/src/py2js.js"></script>
<script type="text/javascript" src="/src/loaders.js"></script>
<script type="text/javascript" src="/src/py_object.js"></script>
<script type="text/javascript" src="/src/py_type.js"></script>
<script type="text/javascript" src="/src/py_utils.js"></script>
<script type="text/javascript" src="/src/py_sort.js"></script>
<script type="text/javascript" src="/src/py_builtin_functions.js"></script>
<script type="text/javascript" src="/src/py_exceptions.js"></script>
<script type="text/javascript" src="/src/py_range_slice.js"></script>
<script type="text/javascript" src="/src/py_bytes.js"></script>
<script type="text/javascript" src="/src/py_set.js"></script>
<script type="text/javascript" src="/src/js_objects.js"></script>
<script type="text/javascript" src="/src/stdlib_paths.js"></script>
<script type="text/javascript" src="/src/py_import.js"></script>
<script type="text/javascript" src="/src/unicode_data.js"></script>
<script type="text/javascript" src="/src/py_string.js"></script>
<script type="text/javascript" src="/src/py_int.js"></script>
<script type="text/javascript" src="/src/py_long_int.js"></script>
<script type="text/javascript" src="/src/py_float.js"></script>
<script type="text/javascript" src="/src/py_complex.js"></script>
<script type="text/javascript" src="/src/py_dict.js"></script>
<script type="text/javascript" src="/src/py_list.js"></script>
<script type="text/javascript" src="/src/py_generator.js"></script>
<script type="text/javascript" src="/src/py_dom.js"></script>

<script type="text/javascript" src="/src/builtin_modules.js"></script>
<script type="text/javascript" src="/src/py_import_hooks.js"></script>
<script type="text/javascript" src="/src/async.js"></script>

<script type="text/javascript" src="/src/brython_stdlib.js"></script>


</body>
</html>
